/*
 * @Author: yaoge233 1351192080@qq.com
 * @Date: 2025-01-05 18:05:50
 * @LastEditors: yaoge233 1351192080@qq.com
 * @LastEditTime: 2025-01-05 18:11:17
 * @FilePath: \react-demo\src\components\AuthRoute.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { getToken } from '@/utils'
import { Navigate } from 'react-router-dom'

const AuthRoute = ({ children }) => {
  const isToken = getToken()
  if (isToken) {
    return <>{children}</>
  } else {
    return <Navigate to="/login" replace />
  }
}

export default AuthRoute